package jmine.tec.hydra.domain.senderRegistry;

import javax.persistence.Column;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.Transient;

import jmine.tec.hydra.send.Sender;
import jmine.tec.hydra.send.impl.mq.MQSender;
import jmine.tec.persist.annotation.DiscriminatorComment;

import org.hibernate.validator.NotNull;

import bancosys.tec.component.Documentation;

/**
 * Registro de dados para envio de arquivos.
 * 
 * @author piercio
 */
@Entity
@DiscriminatorValue(value = "1")
@DiscriminatorComment("REGISTRO PARA QUEUES")
public class MQSenderRegistry extends AbstractSenderRegistry {

    private String queue;

    private String queueConnectionFactory;

    /**
     * @return o nome da fila de envio de mensagens.
     */
    @NotNull
    @Column(name = "MQ_QUEUE")
    @Documentation("NOME DA FILA DE ENVIO MQ.")
    public String getQueue() {
        return this.queue;
    }

    /**
     * @param queue o nome da fila de envio de mensagens.
     */
    public void setQueue(String queue) {
        this.queue = queue;
    }

    /**
     * @return o nome da queue connection factory.
     */
    @NotNull
    @Column(name = "MQ_QUEUE_CON_FACTORY")
    @Documentation("NOME DA QUEUE CONNECTION FACTORY.")
    public String getQueueConnectionFactory() {
        return this.queueConnectionFactory;
    }

    /**
     * @param queueConnectionFactory o nome da queue connection factory.
     */
    public void setQueueConnectionFactory(String queueConnectionFactory) {
        this.queueConnectionFactory = queueConnectionFactory;
    }

    /**
     * @return o sender que grava o xml resultante em um arquivo no diretorio passado.
     */
    @Override
    @Transient
    public Sender getSender() {
        return new MQSender(this);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String toString() {
        return "MQSenderRegistry: " + this.queue + " - " + this.queueConnectionFactory;
    }
}
